﻿@{
    ViewBag.Title = "Form";
    Layout = "~/Views/Shared/_Form.cshtml";
}
<script>
    var keyValue = $.request("keyValue");
    $(function () {
        $("#Account").val($.request('account'));
        $("#Name").val($.request('name'));
    });
    function submitForm() {
        if (!$('#form1').formValid()) {
            return false;
        }
        var postData = $("#form1").formSerialize();
        postData["userPassword"] = $("#UserPassword").val();
        postData["keyValue"] = keyValue;
        //var ret = /^(?![0-9]+$)(?![a-zA-Z]+$)\S{6,16}$/;
        //if (postData["userPassword"] && !ret.test(postData["userPassword"])) {
        //    $.modalAlert("请按要求填写新密码", "error");//密码复杂度不够
        //    return false;
        //}
        $.submitForm({
            url: "/User/SubmitRevisePassword",
            param: postData,
            success: function () {
                $.loading(false)
            }
        })
    }

    //隐藏text block，显示password block
    function showPsw() {
        if ($("#UserPassword").attr("type") == "text") {
            $('#UserPassword').attr("type", "password");
            $('#icon').attr("class", "fa fa-eye");
        } else {
            $('#UserPassword').attr("type", "text");
            $('#icon').attr("class", "fa fa-eye-slash");
            
        }
    }
</script>
<form id="form1">
    <div style="padding-top: 30px; margin-right: 40px;">
        <table class="form">
            <tr>
                <th class="formTitle">账户：</th>
                <td class="formValue">
                    <input id="Account" name="Account" readonly type="text" class="form-control" />
                </td>
            </tr>
            @*<tr>
                <th class="formTitle">姓名：</th>
                <td class="formValue">
                    <input id="Name" name="Name" readonly type="text" class="form-control" />
                </td>
            </tr>*@
            <tr>
                <th class="formTitle"><span class="required">*</span>密码：</th>
                <td class="formValue">
                    <div class="input_block" id="psw_invisible">
                        <input id="UserPassword" name="UserPassword" type="password" class="form-control required" placeholder="请输入新密码" />
                        <i id="icon" class="fa fa-eye" onclick="showPsw()" style="display: inline;float: right;position: relative;top: -20px;height:0px"></i>
                    </div>
                </td>
            </tr>
            @*<tr>
                <th>
                </th>
                <td>
                    &nbsp;&nbsp;
                    <span style="color:#999;">6-16位，必须包含字母数字</span>
                </td>
            </tr>*@
        </table>
    </div>
</form>
